<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>搜索系统</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <!-- Bootstrap -->
      <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
      <link href="/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
      <link href="/bootstrap/css/common.css" rel="stylesheet">
      <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/bootstrap/ico/apple-touch-icon-144-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/bootstrap/ico/apple-touch-icon-114-precomposed.png">
      <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/bootstrap/ico/apple-touch-icon-72-precomposed.png">
      <link rel="apple-touch-icon-precomposed" href="/bootstrap/ico/apple-touch-icon-57-precomposed.png">

      <style type="text/css">

          body {
              font-family: "Microsoft YaHei"
          }
          table {
              font-family: "Microsoft YaHei"
          }
          button {
              font-family: "Microsoft YaHei"
          }


      </style>
      <link href="../../bootstrap/500.css" rel="stylesheet">


  </head>



  <body  data-spy="scroll" data-target=".navbar">


	<div class="container">

        <div style="height: 10px;"></div>


            <form <c:if test="${!tag}">action="search.html"</c:if>  <c:if test="${tag}">action="tag.html"</c:if>   id="form">
                <div style="margin-left: 10px;">

                    <c:if test="${!tag}">
                    <div class="input-prepend">
                        <span class="add-on">类型</span>
                        <select id="category" name="category" onchange="$('#form').submit()" style="height: 30px;line-height: 20px;margin-top:0px">
                            <option value="0" <c:if test="${category eq 0}">selected</c:if>>全部</option>
                            <option value="1" <c:if test="${category eq 1}">selected</c:if> >Abstract</option>
                            <option value="2" <c:if test="${category eq 2}">selected</c:if>>Animals</option>
                            <option value="3" <c:if test="${category eq 3}">selected</c:if>>Black and White</option>
                            <option value="4" <c:if test="${category eq 4}">selected</c:if>>Celebrities</option>
                            <option value="5" <c:if test="${category eq 5}">selected</c:if>>City &amp; Architecture</option>
                            <option value="6" <c:if test="${category eq 6}">selected</c:if>>Commercial</option>
                            <option value="7" <c:if test="${category eq 7}">selected</c:if>>Concert</option>
                            <option value="8" <c:if test="${category eq 8}">selected</c:if>>Family</option>
                            <option value="9" <c:if test="${category eq 9}">selected</c:if>>Fashion</option>
                            <option value="10" <c:if test="${category eq 10}">selected</c:if>>Film</option>
                            <option value="11" <c:if test="${category eq 11}">selected</c:if>>Fine Art</option>
                            <option value="12" <c:if test="${category eq 12}">selected</c:if>>Food</option>
                            <option value="13" <c:if test="${category eq 13}">selected</c:if>>Journalism</option>
                            <option value="14" <c:if test="${category eq 14}">selected</c:if>>Landscapes</option>
                            <option value="15" <c:if test="${category eq 15}">selected</c:if>>Macro</option>
                            <option value="16" <c:if test="${category eq 16}">selected</c:if>>Nature</option>
                            <option value="17" <c:if test="${category eq 17}">selected</c:if>>People</option>
                            <option value="18" <c:if test="${category eq 18}">selected</c:if>>Performing Arts</option>
                            <option value="19" <c:if test="${category eq 19}">selected</c:if>>Sport</option>
                            <option value="20" <c:if test="${category eq 20}">selected</c:if>>Still Life</option>
                            <option value="21" <c:if test="${category eq 21}">selected</c:if>>Street</option>
                            <option value="22" <c:if test="${category eq 22}">selected</c:if>>Transportation</option>
                            <option value="23" <c:if test="${category eq 23}">selected</c:if>>Travel</option>
                            <option value="24" <c:if test="${category eq 24}">selected</c:if>>Underwater</option>
                            <option value="25" <c:if test="${category eq 25}">selected</c:if>>Urban Exploration</option>
                            <option value="26" <c:if test="${category eq 26}">selected</c:if>>Wedding</option>
                        </select>
                    </div>

                    <div class="input-prepend">
                        <span class="add-on">排序</span>
                        <select id="orderby" name="orderby"  onchange="$('#form').submit()" style="height: 30px;line-height: 20px;;margin-top:0px">
                            <option value="0" <c:if test="${orderby eq '0'}">selected</c:if>>相似度</option>
                            <option value="rating" <c:if test="${orderby eq 'rating'}">selected</c:if>>分数</option>
                            <option value="created_date" <c:if test="${orderby eq 'created_date'}">selected</c:if>>日期</option>
                        </select>
                    </div>

                    <div class="input-prepend">
                        <span class="add-on">license</span>
                        <select id="license" name="license"  onchange="$('#form').submit()" style="height: 30px;line-height: 20px;;margin-top:0px">
                            <option value="-1" <c:if test="${license eq -1}">selected</c:if>>全部</option>
                            <option value="0" <c:if test="${license eq 0}">selected</c:if>>500px License</option>
                            <option value="4" <c:if test="${license eq 4}">selected</c:if>>CC BY</option>
                            <option value="5" <c:if test="${license eq 5}">selected</c:if>>CC BY-ND</option>
                            <option value="6" <c:if test="${license eq 6}">selected</c:if>>CC BY-SA</option>
                            <option value="1" <c:if test="${license eq 1}">selected</c:if>>CC BY-NC</option>
                            <option value="2" <c:if test="${license eq 2}">selected</c:if>>CC BY-NC-ND</option>
                            <option value="3" <c:if test="${license eq 3}">selected</c:if>>CC BY-NC-SA</option></select>
                        </select>
                    </div>
                    </c:if>
                        <div class="input-prepend input-append">
                            <span class="add-on">共${total}条数据</span>
                            <input class="span2" type="text" value="${key}" name="key" id="key" style="height: 19px;">
                            <button class="btn" type="submit">搜索</button>
                        </div>
                </div>






            </form>




        <c:forEach items="${result}" var="c">

            <div class="col d4">
                <div class="photo">
                    <a href="./detail.html?id=${c.resourceBean.id}" data-ga-category="Photo Thumbnail" data-ga-action="Title"><img src="${c.resourceBean.url}" /></a>
                    <div class="details">
                        <div class="inside">
                            <div class="title"><a href="./search.html?key=${c.resourceBean.title}">${c.resourceBean.title}</a></div>
                            <div class="info"><a href="./search.html?key=${c.resourceBean.user}" data-ga-action="Image" data-ga-category="Photo Thumbnail">${c.resourceBean.user}</a></div>
                            <div class="rating">${c.resourceBean.rating}</div>
                        </div>
                    </div>
                </div>
            </div>


        </c:forEach>

    </div>
        <script type="text/javascript" src="/js/jquery-1.7.1.min.js"></script>
        <script type="text/javascript" src="/bootstrap/js/bootstrap.min.js"></script>
	
		
   <script>

       $(document).ready(function(){
           //$("#key").focus();

           $("#key").select();

           // $("#category [value='${category}']").attr("selected","true")
           //$("#orderby [value='${orderby}']").attr("selected","true")
           //$("#license [value='${license}']").attr("selected","true")
       })
   </script>
   
  </body>
</html>